import request from '@/utils/request'

/*           sub          */
export function getConsigns (data) {
  return request({
    url: '/goods/getConsigns',
    method: 'get',
    params: data
  })
}

export function batchImport (data) {
  return request({
    url: '/goods/batchImport',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    type: 'form'
  })
}

export function getGoods (query) {
  return request({
    url: '/goods/getGoods',
    method: 'get',
    params: query
  })
}

export function setGoodsBreak (data) {
  return request({
    url: '/goods/setGoodsBreak',
    method: 'post',
    data
  })
}

export function setGoodsState (data) {
  return request({
    url: '/goods/setGoodsState',
    method: 'post',
    data
  })
}

export function passGoodsBuyNum (data) {
  return request({
    url: '/goods/passGoodsBuyNum',
    method: 'post',
    data
  })
}

export function setGoodsStateMulti (data) {
  return request({
    url: '/goods/setGoodsStateMulti',
    method: 'post',
    data
  })
}

export function getGoodsDetail (id) {
  return request({
    url: '/goods/getGoodsDetail',
    method: 'get',
    params: { id }
  })
}

export function delGoodsImg (data) {
  return request({
    url: '/goods/delGoodsImg',
    method: 'post',
    data
  })
}

export function updateGoods (data) {
  return request({
    url: '/goods/updateGoods',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    type: 'form'
  })
}

export function exportDealGoods (lotId) {
  return request({
    url: '/goods/exportDealGoods',
    method: 'get',
    params: { lotId }
  })
}
